package com.wang.seckill.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class MQReceiver {
//    @Resource
//    private RabbitTemplate rabbitTemplate;

    @RabbitListener(queues = "queue")
    public void receive(Object msg) {
        log.info("receive message ->" + msg);
    }

    @RabbitListener(queues = "queue_fanout1")
    public void receive1(Object msg) {
        log.info("receive message from fanout01->" + msg);
    }

    @RabbitListener(queues = "queue_fanout2")
    public void receive2(Object msg) {
        log.info("receive message from fanout02->" + msg);
    }

    @RabbitListener(queues = "queue_topic01")
    public void receive3(Object msg) {
        log.info("receive message from topic01->" + msg);
    }

    @RabbitListener(queues = "queue_topic02")
    public void receive4(Object msg) {
        log.info("receive message from topic02->" + msg);
    }

}
